package com.zzyy.study.controller;

import com.zzyy.study.common.Result;
import com.zzyy.study.common.ResultUtils;
import com.zzyy.study.dto.TransferRequest;
import com.zzyy.study.service.IAccountService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AccountController
{

    @Resource
    private IAccountService accountService;

    @PostMapping("/account/transfer")
    public Result<Boolean> transfer(@RequestBody TransferRequest request)
    {
        this.accountService.transfer(request.getFromAccountId(), request.getToAccountId(), request.getTransferPrice());
        return ResultUtils.success(Boolean.TRUE);
    }
}
